/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.config.dto;

import com.icinfo.cloud.provider.common.exception.BusinessException;
import com.icinfo.cloud.provider.punish.config.enums.DiscretionTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * 自由裁量选择启用标准参数
 *
 * @author Junfeng.Chen
 * @date 2024/1/31 9:04
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RegulatoryChooseDiscretionTypeDto {

    /**
     * 事项唯一id
     */
    @NotEmpty(message = "事项唯一id不能为空")
    private String regulatoryCatalogId;

    /**
     * 启用标准
     */
    @NotNull(message = "启用标准不能为空")
    private DiscretionTypeEnum discretionType;


    /**
     * 判断是否是单位裁量
     */
    public void legality() {
        if (!DiscretionTypeEnum.ORG.equals(this.discretionType)) {
            return;
        }
        throw new BusinessException("启用类型非法");
    }
}